import React from 'react'
import { Tabs } from 'antd'

const TabPane = Tabs.TabPane;

class Header extends React.Component {
	constructor(props) {
		super(props)
		
		this.state = {
			
		}
	}
	
	callback = key =>{
//		console.log(key)
		const params = {
			operatingState: key,
			operatingType: 2
		}
		const {showMenu,onSearch} = this.props
		showMenu(key)
		onSearch(params)
	}
	componentDidMount(){
		const {onSearch,menu,pagination} = this.props
		const params = {
			operatingState: menu,
			operatingType: 2,
			page:pagination.current
		}
		onSearch(params)
	}
	
	render(){
		const {menu} = this.props
		const keys = 1
		const permissions = JSON.parse(sessionStorage.getItem("permissions"))

		return(
			<div>
				<Tabs defaultActiveKey={menu} onChange={this.callback}>
					{permissions.indexOf("file:fileDestroy:apply") != -1?
					<TabPane tab="销毁申请" key="0">
			            
			         </TabPane>
					:""}
					
					{permissions.indexOf("file:fileDestroy:apply") != -1?
			         <TabPane tab="我提交的" key="2">
			           
			         </TabPane>
					:""}
					
					{permissions.indexOf("file:fileDestroy:checked") != -1?
			         <TabPane tab="待审核" key="1">
			           
			         </TabPane>
					:""}
					
					{permissions.indexOf("file:fileDestroy:checked") != -1?
			         <TabPane tab="已审核" key="3">
			           
			         </TabPane>
					:""} 
				</Tabs>
			</div>
		)
	}
}

export default Header